{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "d3201184",
   "metadata": {},
   "source": [
    "# Errata\n",
    "\n",
    "\n",
    "(Books ordered before ~12:00 PM GMT on June 13, 2023)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ea449a06",
   "metadata": {},
   "source": [
    "## Chapter 02\n",
    "\n",
    "\n",
    "**Page 22**\n",
    "\n",
    "\n",
    "In the book (p. 22) we say:\n",
    "_______________________________________________________________\n",
    "\n",
    "*(...) the probability of buying book A, given we bought book B, is 63.8%. This indicates a\n",
    "positive relationship between both variables (if there was no association between them, we would\n",
    "expect the result to be <font color='red'>**50%**</font>)*\n",
    "\n",
    "\n",
    "This is <font color='red'>**incorrect**</font>. \n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "The <font color='green'>**correct**</font> statement should be:\n",
    "\n",
    "*(...) the probability of buying book A, given we bought book B, is 63.8%. This indicates a\n",
    "positive relationship between both variables (if there was no association between them, we would\n",
    "expect the result to be <font color='green'>**39%**</font>)*\n",
    "_______________________________________________________________\n",
    "\n",
    "    \n",
    "*Thanks for David for spotting this mistake.*"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "952febd2",
   "metadata": {},
   "source": [
    "## Chapter 04\n",
    "\n",
    "\n",
    "<font color='red'>**Figure 4.1**</font> is <font color='red'>**incorrect**</font>.\n",
    "\n",
    "The <font color='green'>**correct**</font> version of **Figure 4.1** is the following:\n",
    "\n",
    "<img src=\"img/ch_04__fig_4_1.png\" width=400>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "85952f08",
   "metadata": {},
   "source": [
    "## Chapter 06\n",
    "\n",
    "### You’re gonna keep ‘em d-separated\n",
    "\n",
    "\n",
    "<font color='red'>**Figure 6.3**</font> representing DAG **d)** in the *Keep 'em d-separated* game is <font color='red'>**incorrect**</font>.\n",
    "\n",
    "The <font color='green'>**correct**</font> version of **Figure 6.3** is the following:\n",
    "\n",
    "<img src=\"img/ch_06__fig_6_3.png\" width=450>\n",
    "\n",
    "<br><br>\n",
    "\n",
    "\n",
    "<font color='red'>**Figure 6.4**</font> representing DAG **e)** in the *Keep 'em d-separated* game is <font color='red'>**incorrect**</font>.\n",
    "\n",
    "The <font color='green'>**correct**</font> version of **Figure 6.4** is the following:\n",
    "\n",
    "<img src=\"img/ch_06__fig_6_4.png\" width=450>\n",
    "\n",
    "<br><br>\n",
    "\n",
    "\n",
    "<font color='red'>**Figure 6.5**</font> representing **all DAGs** in the *Keep 'em d-separated* game is <font color='red'>**incorrect**</font>.\n",
    "\n",
    "The <font color='green'>**correct**</font> version of **Figure 6.5** is the following:\n",
    "\n",
    "<img src=\"img/ch_06__fig_6_5.png\" width=650>\n",
    "\n",
    "\n",
    "### Instrumental variables\n",
    "\n",
    "**Page 121**\n",
    "\n",
    "In the book (p. 121) one of the formulas for regression models is <font color='red'>**incorrect**</font>. \n",
    "\n",
    "The book says:\n",
    "\n",
    "_________\n",
    "\n",
    "\n",
    "*To calculate the causal effect of X on Y in a linear case, all we need to do is fit two linear regression\n",
    "models and compute the ratio of their coefficients!*\n",
    "\n",
    "*The two models are as follows:*\n",
    "\n",
    "*• Y ~ Z*\n",
    "\n",
    "<font color='red'>*• Y ~ X*</font>\n",
    "\n",
    "_____________\n",
    "\n",
    "\n",
    "The <font color='green'>**correct**</font> formulas should be:\n",
    "\n",
    "_____________\n",
    "\n",
    "*The two models are as follows:*\n",
    "\n",
    "*• Y ~ Z*\n",
    "\n",
    "<font color='green'>*• X ~ Z*</font>\n",
    "\n",
    "__________________\n",
    "\n",
    "\n",
    "The **code example** below uses the <font color='green'>**correct formulas**</font>."
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8c0953ef",
   "metadata": {},
   "source": [
    "## Chapter 07\n",
    "\n",
    "\n",
    "<font color='red'>**Figure 7.6**</font> is <font color='red'>**incorrect**</font>.\n",
    "\n",
    "The <font color='green'>**correct**</font> version of **Figure 7.6** is the following:\n",
    "\n",
    "<img src=\"img/ch_07__fig_7_6.png\" width=500>"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7575e3b4",
   "metadata": {},
   "source": [
    "## Chapter 13\n",
    "\n",
    "\n",
    "**Page 343** (point 3)\n",
    "\n",
    "\n",
    "In the book (p. 343) in point **3.** we say:\n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "3. *We remove the edges between <font color='red'>**P and Q**</font>, and Q and S, as P ⫫ Q | R and Q ⫫ S | R (C).*\n",
    "\n",
    "\n",
    "This is <font color='red'>**incorrect**</font>. \n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "The <font color='green'>**correct**</font> statement should be:\n",
    "\n",
    "3. *We remove the edges between <font color='green'>**P and S**</font>, and Q and S, as P ⫫ Q | R and Q ⫫ S | R (C).*\n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "    \n",
    "*Thanks for Miguel for spotting this mistake.*\n",
    "    \n",
    "______________________________________________________\n",
    "<br><br>\n",
    "\n",
    "**Page 343** (point 4)\n",
    "\n",
    "In the book (p. 343) in point **4.** we say:\n",
    "_______________________________________________________________\n",
    "\n",
    "4. *We orient the edges <font color='red'>**P -> R <- S**</font> because R is a collider between <font color='red'>**P and S**</font> (D).*\n",
    "\n",
    "\n",
    "This is <font color='red'>**incorrect**</font>. \n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "The <font color='green'>**correct**</font> statement should be:\n",
    "\n",
    "4. *We orient the edges <font color='green'>**P -> R <- Q**</font> because R is a collider between <font color='green'>**P and Q**</font> (D).*\n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "    \n",
    "*Thanks for Takashi for spotting this mistake.*"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7d249ae5",
   "metadata": {},
   "source": [
    "## Chapter 14\n",
    "\n",
    "**Page 391** (bullet point 1)\n",
    "\n",
    "\n",
    "In the book (p. 391) in the first bullet point we say:\n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "*- <font color='red'>**X**</font> is not an ancestor of <font color='red'>**Y**</font> - there might be...*\n",
    "\n",
    "\n",
    "This is <font color='red'>**incorrect**</font>. \n",
    "\n",
    "_______________________________________________________________\n",
    "\n",
    "The <font color='green'>**correct**</font> statement should be:\n",
    "\n",
    "*- <font color='green'>**Y**</font> is not an ancestor of <font color='green'>**X**</font> - there might be...*\n",
    "_______________________________________________________________\n",
    "\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
